package com.weigecoder.exception;

import com.weigecoder.common.result.ResultCodeEnum;
import lombok.Data;

@Data
public class MineException extends RuntimeException {
    private Integer code;//状态码
    private String msg;//描述信息

    public MineException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public MineException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
    }

    @Override
    public String toString() {
        return "MineException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }

}
